<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 500px;
            height: 100px;
            border: 1px solid lightgreen;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        // 递归函数应用场景: 递归函数 + 延迟函数 ===> 显示当前系统时间


        let div = document.querySelector('div')

        function fn() {
            let dt = new Date();
            div.innerHTML = dt.toLocaleTimeString();
            setTimeout(fn, 1000);
        }
        fn()

    </script>
</body>

</html>